package design_pattern.factory_abstract;

public class YinSheng implements NWFactory {
  Woman w = null;
  Cow c = null;

  @Override
  public Woman createPerson(String type) {
    try {
      w = (Woman) Class.forName("factory_abstract." + type).newInstance();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return w;
  }

  @Override
  public Cow createAnimal(String type) {
    try {
      c = (Cow) Class.forName("factory_abstract." + type).newInstance();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return c;
  }

}
